﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ArgusLight.Fractals2D;
using ArgusControls;

namespace Fractals
{
	public class ControlComplexFractalParameter : ControlFractalParameter
	{
		protected LogarithmicNumericUpDown nudIterations;

		public override UIElement GetUIElement()
		{
			if (this.grid != null)
				return this.grid;

			base.GetUIElement();

			this.AddLabel(Localization.Text.FractalParameterIterations, 3, 0);
			this.nudIterations = new LogarithmicNumericUpDown();
			this.nudIterations.Foreground = new SolidColorBrush(Colors.White);
			this.nudIterations.BorderBrush = new SolidColorBrush(Colors.White);
			this.nudIterations.Margin = new Thickness(5, 5, 5, 0);
			this.nudIterations.VerticalAlignment = System.Windows.VerticalAlignment.Center;
			this.nudIterations.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
			this.nudIterations.Minimum = 1;
			this.nudIterations.Increment = 100;
			this.nudIterations.Maximum = 100000;
			this.AddToGrid(this.nudIterations, 3, 1);

			return this.grid;
		}

		public override void SetValues(FractalParameter fParameter)
		{
			base.SetValues(fParameter);
			ComplexFractalParameter para = (ComplexFractalParameter)fParameter;
			this.nudIterations.Value = para.Iterations;
		}

		public override void GetValues(ref FractalParameter fParameter)
		{
			base.GetValues(ref fParameter);
			ComplexFractalParameter para = (ComplexFractalParameter)fParameter;
			para.Iterations = (int)this.nudIterations.Value;
		}
	}
}
